<template>
  <input type = "text" @click = "select()" name = "user_pwd" :value = "value"
  >
</template>
<script>
  import MaterialDateTimePicker from './material-datetime-picker/lib/js/index.js'

  export default {
    props: {
      value: {
        default: ''
      }
    },
    mounted () {
      this.picker = new MaterialDateTimePicker({container: document.body})
        .on('submit', this.submit)
    },
    methods: {
      select () {
        this.picker.open(this.value)
      },
      submit (mount) {
        let val = mount.format('YYYY-MM-DD HH:mm')
        this.value = val
        this.$emit('submit', val)
      }
    }

  }
</script>
<style lang = "scss">
  @import "./material-datetime-picker/lib/scss/material-datetime-picker.scss";
  
</style>
